package com.bnyy.medicalHousekeeper.activity;

import android.os.Bundle;

import androidx.appcompat.app.AlertDialog;

import com.bnyy.medicalHousekeeper.DialogHelper;
import com.bnyy.medicalHousekeeper.R;
import com.bnyy.medicalHousekeeper.base.App;
import com.bnyy.medicalHousekeeper.base.BaseActivityImpl;
import com.bnyy.medicalHousekeeper.request.BaseObserverImpl;
import com.bnyy.medicalHousekeeper.request.RequestManager;

import java.util.HashMap;

import butterknife.OnClick;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2022/4/13
 **/
public class AccountCancelActivity extends BaseActivityImpl {
    @Override
    public int getLayoutId() {
        return R.layout.activity_account_cancel;
    }

    @Override
    public String getTitleStr() {
        return "注销账号";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @OnClick(R.id.tv_confirm)
    public void onViewClicked() {
        DialogHelper.showNormalDialog(mContext, "请再次确认是否要注销该账号", "确认注销",
                new DialogHelper.Callback() {
                    @Override
                    public void onRightClick(AlertDialog alertDialog) {
                        super.onRightClick(alertDialog);
//                        HashMap<String, String> params = new HashMap<>();
//                        params.put("alias", String.format("bnyy_user_%s", userInfoManager.getLoginUserId()));
//                        requestManager.request(requestManager.mJavaRetrofitService.deleteAlias(RequestManager.getJsonRequestBody(params)),
//                                new BaseObserverImpl<Object>() {
//                                });

                        requestManager.request(requestManager.mJavaRetrofitService.logout(),
                                new BaseObserverImpl<Object>(mContext) {
                                    @Override
                                    public void onSuccess() {
                                        super.onSuccess();
                                        App.loginInvalid();
                                    }
                                });

//                        requestManager.request(requestManager.mJavaRetrofitService.accountCancel(),
//                                new BaseObserverImpl<Object>(mContext) {
//                                    @Override
//                                    public void onSuccess() {
//                                        super.onSuccess();
//                                        App.loginInvalid();
//                                    }
//                                });
                    }
                });
    }
}
